/*Program BizzBuzz.cpp
* Input: <number> <number>...
* Output: "bizz" if number % 3 == 0, "buzz" if number % 5 == 0, 
* "bizzbuzz" if number % 15 == 0, else number;
* Cases: 
* wrong: 0.1, --5, 9a9, 123_456_-;
* right: 555555555555555555555555555, _1_______5, -01, -000015, 15, -123_5.
 * Author: Marina Kaznacheeva
 */
#include <iostream>
#include <string>
#include <sstream>
#include "logger.h"

using namespace std;

bool tryModThree(int sum) {	
	stringstream ss;
	ss << sum;
	string str = ss.str();
	// anyav: better use std::to_string (if C++11 is available)

	int ssum =0, len = str.length();

	for(int k = 0; k < len; k++)
		ssum += (str[k] - '0');
	
	if(ssum == 0 || ssum == 3 || ssum == 6 || ssum == 9 )
		return true;
	else if(ssum < 10)
			return false;
		else return tryModThree(ssum);
}

bool tryModFive(string num) {
	int len = num.length();

	return (num[len-1] == '5' || num[len-1] == '0');
}

int main() {
    int i, n, sum = 0, sign = 1; //sign: 1 <-> +, 0 <-> -
    string str, answ, num, bi = "bizz ", bu = "buzz ", bb = "bizzbuzz ";
    bool modThree = false, modFive = false;

    getline(cin,str);
    n = str.length();
    
    //cout << str.max_size() << endl;
    
	if(unsigned(n) >= str.max_size()) {
		logWrite("LOG_ACCESS", printTime(), __FILE__, __LINE__, 
				"The size of buffer has been exceeded by input data."); 
		return 4;
	}
	
    for(i = 0; i < n; i++) {
		//i += 100;
		if(i >= n) {
			logWrite("LOG_ACCESS", printTime(), __FILE__, __LINE__, 
				"The size of buffer has been exceeded in cycle."); 
			return 3;
		}
	
		if(n == i + 1)
			logWrite("LOG_WARNING", printTime(), __FILE__, __LINE__, 
					"The end of buffer is reached."); 
		
		modThree = false;
		modFive = false;
		
		if((str[i] > '9' || str[i] < '0') && str[i] != ' ' && str[i] != '-') {
			logWrite("LOG_ERROR", printTime(), __FILE__, __LINE__, "Incorrect input data."); 
			// anyav: better for user experience to give a small help on possible input
			return 1;
		}
		//--5
		if(str[i] == '-') {
			if((i == 0 || str[i-1] == ' ') && i != n - 1 && sign != 0) {
				sign = 0;
				// anyav: sign is quite illogical. it is false(0) when sign is present...
			}
			else {
				logWrite("LOG_ERROR", printTime(), __FILE__, __LINE__, "Incorrect input data."); 
				// anyav: the user is curious. what's gone wrong? a small help is badly needed
				return 2;
			}
		}
		// anyav: switch operator would look better for these checks
		// a finite state machine logic (waiting for begin, waiting for digit, waiting for end) may be not bad in this situation as well
	
		if(str[i] <= '9' && str[i] >= '0') {
			num += str[i];
			sum += (str[i] - '0');
		}
		//_1_2
		if(i == 0 && str[i] == ' ')
			continue;
		//1____5
		if(i != 0 && str[i] == ' ' && str[i-1] == ' ')
			continue;
		//end of number
		if(str[i] == ' ' || i == n - 1) {
			modThree = tryModThree(sum);
			modFive = tryModFive(num);
				
			if(modThree == true && modFive == true)
				answ += bb;
			else if(modFive == true)
					answ += bu;
				else if(modThree == true)
					answ += bi;
					else {
						if(sign == 0)
							answ += ('-' + num + ' ');
						else
							answ +=  (num + ' ');
						sign = 1;
					}
			sum = 0;
			num = "";
		}
	}
    cout << endl << answ << endl;
    return 0;
}
